# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=eclipse-ecj
pkgver=4.15
_pkgdate=202003050155
pkgrel=0
pkgdesc="Eclipse java bytecode compiler"
url="http://www.eclipse.org/jdt/core/index.php"
arch="noarch !x86 !armv7 !armhf !mips !mips64"  # openjdk11 availability
license="EPL-2.0"
depends="java-common"
makedepends="apache-ant openjdk11-jdk"
subpackages="$pkgname-doc"
builddir="$srcdir"

source="
	ecjsrc-$pkgver.zip::https://archive.eclipse.org/eclipse/downloads/drops4/R-$pkgver-$_pkgdate/ecjsrc-$pkgver.jar
	ecj
	10-jar-signature.patch
	"

build() {
	ant build
}

package() {
	install -Dm644 "$srcdir/ecj.jar" "$pkgdir/usr/share/java/eclipse-ecj-$pkgver.jar"
	ln -s eclipse-ecj-$pkgver.jar "$pkgdir/usr/share/java/ecj.jar"
	ln -s eclipse-ecj-$pkgver.jar "$pkgdir/usr/share/java/eclipse-ecj.jar"
	install -Dm755 ecj "$pkgdir/usr/bin/ecj"
	install -D -m 644 ecj.1 "$pkgdir/usr/share/man/man1/ecj.1"
}

check() {
	CLASSPATH=$srcdir/ecj.jar ./ecj -v
}
sha512sums="ada55b2522cf26570f0cd43f415eb5cf20e6840f83dadc72e1ae474ebf10eadca73f9fa3d1db51e13fd2762c38cd3e3567db3c7840d43ae3d8665ebe35e1889d  ecjsrc-4.15.zip
17272b6bb21efeada37d60c1831685bc25128eddf55338807861a65c5117b37df8e18373f120f06e7488438d05750592029bf4dc9c74e38bc4159e4dc43dd2bf  ecj
cd2c1f00184fccad8b4a9d72998dfe30bd6502e565cad427342cec047ec621def8d14800dccc69e3ebb2681b2daecc2c30e285649861a72258a5f84458f0b281  10-jar-signature.patch"
